<!-- The ref attr used to find the swiper instance -->
<template>
  <div class="swiper-wrapper">
    <swiper :options="swiperOption" v-if="swiperList.length">
      <!-- slides -->
      <swiper-slide v-for="item in swiperList" :key="item.id">
        <img class="swiper-img" :src="item.imgUrl" />
      </swiper-slide>
      <!-- Optional controls -->
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: "HomeSwiper",
  props: {
    swiperList: Array
  },
  data() {
    return {
      swiperOption: {
        pagination: ".swiper-pagination", //分页器圆点
        loop: true, //设置虚幻轮播，无缝
        autoplay: 3000
      }
    };
  },
  activated: function() {
    
  }
};

</script>

<style lang="stylus" scoped>
.swiper-wrapper >>> .swiper-pagination-bullet-active {
  background-color: #fff;
}

.swiper-wrapper {
  height: 2.88rem;
  margin-top: 0.88rem;
  background-color: #eee;
}

.swiper-wrapper .swiper-img {
  width: 100%;
  height: 100%;
}
</style>